package reflect;

import java.lang.reflect.Constructor;

public class Test {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("reflect.Student");
        Object obj = cls.newInstance(); //无参构造器实例化对象
        System.out.println(obj);

        Constructor c = cls.getConstructor(String.class,int.class,char.class);
        Object obj1 = c.newInstance("张三",24,'男'); //有参构造器实例化对象
        System.out.println(obj1);











    }
}

